package host.springboot.framework.context.mvc.converter;

import host.springboot.framework.core.constant.PatternConstant;
import org.jspecify.annotations.NonNull;
import org.springframework.core.convert.converter.Converter;

import java.time.YearMonth;

/**
 * {@code YearMonth} 自定义转换器
 *
 * @author JiYinchuan
 * @since 1.0.0
 */
public class YearMonthConverter implements Converter<String, YearMonth> {

    @Override
    public YearMonth convert(@NonNull String source) {
        return YearMonth.parse(source, PatternConstant.Date.NORM_YEARMONTH_FORMATTER);
    }
}
